package com.wushijia.designpatterns.command;

/**
 * description:命令模式测试......宏命令【一堆命令一起执行】
 *
 * @author yang
 * @date 2018/1/19 20:33
 */
public class CommandTest {

  public static void main(String[] args) {
    Light light = new Light();
    LightCommand lightCommand = new LightCommand(light);
    LightControl lightControl = new LightControl();
    lightControl.setCommand(lightCommand);
    lightControl.buttonWasPressed();

    RemoteControlWithUndo remoteControlWithUndo = new RemoteControlWithUndo();
    remoteControlWithUndo.setCommand(0, lightCommand, lightCommand);
    remoteControlWithUndo.onButtonWithPressed(0);
    remoteControlWithUndo.offButtonWithPressed(0);
    remoteControlWithUndo.undoButtonWithPressed();
  }
}
